/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jirc;

import java.io.IOException;
import jirc.pircbot.IrcException;
import jirc.pircbot.PircBot;

/**
 * Represents a single instance of an IRC Server.
 * @author David
 */
public class IRCServer extends PircBot {
	public IRCServer() {

	}

	public IRCServer(String hostname) throws IOException, IrcException {
		this("TestUser", hostname);
	}

	public IRCServer(String userName, String hostname) throws IOException, IrcException {
		this(userName, hostname, 6667, null);
	}

	public IRCServer(String userName, String hostname, int port) throws IOException, IrcException {
		this(userName, hostname, port, null);
	}

	public IRCServer(String userName, String hostname, int port, String password) throws IOException, IrcException {
		this.setName(userName);
		this.connect(hostname);
	}

	@Override
	protected void onMessage(String channel, String sender, String login, String hostname, String message) {
		Core.mainApp.processMessage(this, channel, sender, login, hostname, message);
	}

	@Override
	protected void onAction(String sender, String login, String hostname, String target, String action) {
		Core.mainApp.processAction(this, target, sender, login, hostname, action);
	}

	@Override
	public void log(String line) {
		Core.mainApp.processServerMsg(this, line);
	}
}
